/****************************************************************************
  From Qt Examples
****************************************************************************/

#ifndef Server_H
#define Server_H

#include <QStringList>
#include <QTcpServer>
#include "simuhost.h"

class Server : public QTcpServer
{
    Q_OBJECT

public:
    Server(QObject *parent = 0);
    void setMsg(QString msg);
    //void sendMsg();
    void sendServerData(QString serverData);
    QString getCMSG();
    void ProxyConnection(QString IP, int port);

signals:
    void transferMessage(QString);
    void sendInfo(QString);

protected:
    void incomingConnection(int socketDescriptor);

public slots:
    //void ReadCMsg();
    void getMSG(QString);
    void setHardwareSpec(double, double, unsigned int, unsigned int);
private slots:
    void startServerSim();
    void stopServerSim();
    void recieveProxyData();
    void sendSimUpdate();

private:
    QString message;
    QString proxyData;
    int SDescriptor;
    QTcpSocket* connection;
    quint16 proxyBlockSize;
    QString currentMSG;
    QList<int> socketDescs;
    QTcpSocket *proxySocket;
    SimuHost *serverSim;
    double clockSpeed;
    double ipc;
    unsigned int MTTF;
    unsigned int MTTR;
};

#endif
